package arch.chameleon.module.security.realm.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

@Entity
@Table(name = "SHIRO_USER")
public class SUser implements Serializable {

	private static final long serialVersionUID = 4217552840845861333L;
	
	@Id
	@Column(name = "ID")
	private String id;
	@Column(name = "LOGIN_NAME")
	private String loginName;
	@Column(name = "NAME")
	private String name;
	@Column(name = "PASSWORD")
	private String password;
	@Column(name = "SALT")
	private String salt;
	@Column(name = "EMAIL")
	private String email;
	@Column(name = "STATUS")
	@Enumerated(EnumType.STRING)
	private EShiroUserStatus status;

	
	
	public SUser(){}

	public SUser(String id, String loginName, String name, String password,
			String salt, String email, EShiroUserStatus status, String roleName) {
		this.id = id;
		this.loginName = loginName;
		this.name = name;
		this.password = password;
		this.salt = salt;
		this.email = email;
		this.status = status;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public EShiroUserStatus getStatus() {
		return status;
	}

	public void setStatus(EShiroUserStatus status) {
		this.status = status;
	}


	@Override
	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}

	@Override
	public boolean equals(Object obj) {
		return EqualsBuilder.reflectionEquals(this, obj);
	}

	@Override
	public String toString() {
		return ReflectionToStringBuilder.toString(this,
				ToStringStyle.MULTI_LINE_STYLE);
	}

}
